﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Simnova.Collaborate.ASPMVC.Views.Home.Login" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
<script type="text/javascript">
    $(document).ready(function(){
    
        $("#loginForm").submit(function(){
            var f = $("#loginForm");
            var action = f.attr("action");
            var serializedForm = f.serialize();
            $.post(
                action,
                serializedForm,
                function(data, textStatus){
                    var output = eval(data);
                    switch(output)
                    {
                        case "pass":
                            window.location = "/Dashboard";
                            break;
                            
                        case "fail":
                            $("#loginDiv").effect('shake',{ distance: 10, times: 5 });
                            break;
                    }
                });
            return false;
        });
        
        jQuery().ajaxStart(function(){
            $("#loginForm2").fadeOut("slow");
        });

        jQuery().ajaxStop(function(){
            $("#loginForm2").fadeIn("fast");
        });
        
    });
</script>
<div>
<div id="loginDiv">
    <form id="loginForm" action="/Login/Authenticate" method="post">
        <p>
          <label for="email">Email</label><br />
          <input name="Email" type="text" size="30" />
        </p>
        <p>
          <label for="password">Password</label><br />
          <input name="Password" type="password" size="30" />
        </p>
        <p><input name="commit" type="submit" value="Login" /></p>
    </form>
</div>
</div>
</asp:Content>
